#include "closebutton.h"

CloseButton::CloseButton(QWidget *parent) :
    QPushButton(parent)
{

    QString *imageUrl1=new QString(":/image/guanji_1.svg");
    QString *imageUrl2=new QString(":/image/guanji_2.svg");

    setFixedSize(50,50);
    setCloseButtonStyle(*imageUrl1,*imageUrl2);

}

void CloseButton::setCloseButtonStyle(const QString &imageUrl1, const QString &imageUrl2) {
    QString buttonStyle = "QPushButton{"
            "border-image:url(%1);"
            "border-style:outset;"
            "border-width:4px;"
            "border-radius:10px;"
            "border-color:rgba(255,255,255,50);"
            "}"
            "QPushButton:pressed{"
            "border-image:url(%2);"
            "background-color:rgba(100,255,100,0);"
            "border-color:rgba(255,255,255,50);"
            "border-style:outset;"
            "color:rgba(0,0,0,100);"
            "}"
            "QPushButton:hover{"
            "border-color:rgba(255,255,255,200);"
            "color:rgba(0,0,0,200);"
            "}";

    this->setStyleSheet(buttonStyle.arg(imageUrl1).arg(imageUrl2));
}
